<?php
require('../vendor/autoload.php');

use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeyFactory;
use BitWasp\Bitcoin\Network\NetworkFactory;

$xprv = file_get_contents('./wallet/master-xprv');
$network = NetworkFactory::bitcoinRegtest();
$masterKey = HierarchicalKeyFactory::fromExtended($xprv,$network);

$key = $masterKey->derivePath('m/0h/0h/4h');
echo 'private key m/0h/0h/4 => ' . $key->getPrivateKey()->getHex() . PHP_EOL;